package org.example.entity;


import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;


public class LoginUser implements UserDetails, Serializable {

    private CommonUserInfo commonUserInfo;

    private LoginInfo loginInfo;

    public LoginUser() {
    }

    public LoginUser(LoginInfo loginInfo) {
        this.loginInfo = loginInfo;
    }

    public LoginUser(CommonUserInfo commonUserInfo) {
        this.commonUserInfo = commonUserInfo;
    }

    public LoginUser(CommonUserInfo commonUserInfo, LoginInfo loginInfo) {
        this.commonUserInfo = commonUserInfo;
        this.loginInfo = loginInfo;
    }

    public CommonUserInfo getCommonUserInfo() {
        return commonUserInfo;
    }

    public void setCommonUserInfo(CommonUserInfo commonUserInfo) {
        this.commonUserInfo = commonUserInfo;
    }

    public LoginInfo getLoginInfo() {
        return loginInfo;
    }

    public void setLoginInfo(LoginInfo loginInfo) {
        this.loginInfo = loginInfo;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return loginInfo.getPassword();
    }

    @Override
    public String getUsername() {
        return loginInfo.getUsername();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}